Skip to content

Conversation

@WillFroom
Copy link
Contributor

Following on from #150948

@llvmbot llvmbot added the mlir label Aug 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Aug 4, 2025

@llvm/pr-subscribers-mlir

Author: Will Froom (WillFroom)

Changes

Following on from #150948


Full diff: https://github.com/llvm/llvm-project/pull/151963.diff

1 Files Affected:

  • (modified) mlir/test/CAPI/pass.c (+17)
diff --git a/mlir/test/CAPI/pass.c b/mlir/test/CAPI/pass.c
index 3aad0016b393c..9907c64d12cfc 100644
--- a/mlir/test/CAPI/pass.c
+++ b/mlir/test/CAPI/pass.c
@@ -486,6 +486,23 @@ void testExternalPass(void) {
       exit(EXIT_FAILURE);
     }
 
+    // Run the pass again and confirm that the initializeCallCount is still 1.
+    MlirLogicalResult second_success = mlirPassManagerRunOnOp(pm, module);
+    if (mlirLogicalResultIsFailure(second_success)) {
+      fprintf(stderr, "Unexpected failure running external pass.\n");
+      exit(EXIT_FAILURE);
+    }
+
+    if (userData.initializeCallCount != 1) {
+      fprintf(stderr, "Expected initializeCallCount to be 1\n");
+      exit(EXIT_FAILURE);
+    }
+
+    if (userData.runCallCount != 2) {
+      fprintf(stderr, "Expected runCallCount to be 2\n");
+      exit(EXIT_FAILURE);
+    }
+
     mlirPassManagerDestroy(pm);
 
     if (userData.destructCallCount != userData.constructCallCount) {

@WillFroom WillFroom merged commit 4431331 into llvm:main Aug 4, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants